;
var mamber_reg_ops = {
    init: function () {
        this.eventBind();
    },
    eventBind: function () {
        $(".reg_wrep .do_reg").click(function () {
            var btn_target = $(this);
            if (btn_target.hasClass("disabled")) {
                $('.toast-body').text("正在处理，请不要重复点击");
                $('.toast').toast({delay: 2000});
                $('.toast').toast('show');
                return;
            } else {
                var login_name = $(".reg_wrep input[name=login_name]").val();
                var login_pwd = $(".reg_wrep input[name=login_pwd]").val();
                var login_qrpwd = $(".reg_wrep input[name=login_qrpwd]").val();
                if (login_name == "" || login_name.len < 1) {
                    $("#emailHelp").show()
                    $("#emailHelp2").hide()
                    $("#emailHelp3").hide()
                    return;
                } else {
                    if (login_pwd == "" || login_pwd.len < 6) {
                        $("#emailHelp").hide()
                        $("#emailHelp2").show()
                        $("#emailHelp3").hide()
                        return;
                    } else if (login_qrpwd != login_pwd) {
                        $("#emailHelp").hide();
                        $("#emailHelp2").hide();
                        $("#emailHelp3").show();
                        return;
                    } else {
                        $("#emailHelp").hide();
                        $("#emailHelp2").hide();
                        $("#emailHelp3").hide();
                        btn_target.addClass("disabled")
                        $.ajax({
                            url: common_ops.buildUrl("/member/reg"),
                            type: "POST",
                            data: {
                                login_name: login_name,
                                login_pwd: login_pwd,
                                login_qrpwd: login_qrpwd,
                            },
                            dataType: "json",
                            success: function (res) {
                                btn_target.removeClass("disabled")
                                $('.toast-body').text(res.msg);
                                $('.toast').toast({delay: 2000});
                                $('.toast').toast('show');
                                if (res.code == 200) {
                                    window.location.href = "/";
                                }
                            }
                        });
                    }
                }
            }
        });
    }
};
$(document).ready(function () {
    $("#emailHelp").hide()
    $("#emailHelp2").hide()
    $("#emailHelp3").hide()
    mamber_reg_ops.init()
});